package com.untour.im.server.service;

import com.untour.im.codec.protocol.packet.request.header.RequestPacketHeader;
import com.untour.im.common.enums.DeviceMultiLoginEnum;
import com.untour.im.server.dto.UserChannelInfo;
import io.netty.channel.ChannelHandlerContext;

import java.util.List;
import java.util.Map;

public interface DeviceMultiLoginService {
    DeviceMultiLoginEnum deviceMultiLogin();

    /**
     * 保存用户信息和channel信息
     * @param ctx
     * @param userId
     * @param header
     * @param userIdChannelsMap
     * @param channelIdUserIdMap
     */
    void saveUserChannel(ChannelHandlerContext ctx, String userId,
                         RequestPacketHeader header,
                         Map<String, List<UserChannelInfo>> userIdChannelsMap,
                         Map<String, String> channelIdUserIdMap);

    /**
     * 删除用户信息和渠道信息
     * @param ctx
     * @param userIdChannelsMap
     * @param channelIdUserIdMap
     */
    void removeChannelAndUserCache(ChannelHandlerContext ctx,
                                   Map<String, List<UserChannelInfo>> userIdChannelsMap,
                                   Map<String, String> channelIdUserIdMap);
}
